window.log = function () {
    log.history = log.history || [];
    log.history.push(arguments);
    if (this.console) {
        arguments.callee = arguments.callee.caller;
        var b = [].slice.call(arguments); (typeof console.log === "object" ? log.apply.call(console.log, console, b) : console.log.apply(console, b))
    }
}; 

(function (e) {
    function h() { }
    for (var g = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","), f; f = g.pop(); ) {
        e[f] = e[f] || h
    }
})((function () {
    try {
        console.log();
        return window.console
    } catch (a) {
        return window.console = {}
    }
})()); 

(function ($) {
    function getViewportHeight() {
        var height = window.innerHeight;
        var mode = document.compatMode;
        if ((mode || !$.support.boxModel)) {
            height = (mode == "CSS1Compat") ? document.documentElement.clientHeight : document.body.clientHeight
        }
        return height
    }
    $(window).scroll(function () {
        var vpH = getViewportHeight(),
		scrolltop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop),
		elems = [];
        $.each($.cache, function () {
		    if (this.events && this.events.inview) {
		        elems.push(this.handle.elem)
		    }
		});
        if (elems.length) {
            $(elems).each(function () {
                var $el = $(this),
				top = $el.offset().top,
				height = $el.height(),
				inview = $el.data("inview") || false;
                if (scrolltop > (top + height) || scrolltop + vpH < top) {
                    if (inview) {
                        $el.data("inview", false);
                        $el.trigger("inview", [false])
                    }
                } else {
                    if (scrolltop < (top + height)) {
                        if (!inview) {
                            $el.data("inview", true);
                            $el.trigger("inview", [true])
                        }
                    }
                }
            })
        }
    });
    $(function () {
        $(window).scroll()
    });

$.fn.columnize = function (options) {
        var defaults = {
            width: 400,
            columns: false,
            buildOnce: false,
            overflow: false,
            doneFunc: function () { },
            target: false,
            ignoreImageLoading: true,
            "float": "left",
            lastNeverTallest: false
        };
        var options = $.extend(defaults, options);
        return this.each(function () {
            var $inBox = options.target ? $(options.target) : $(this);
            var maxHeight = $(this).height();
            var $cache = $("<div></div>");
            var lastWidth = 0;
            var columnizing = false;
            $cache.append($(this).children().clone(true));
            if (!options.ignoreImageLoading && !options.target) {
                if (!$inBox.data("imageLoaded")) {
                    $inBox.data("imageLoaded", true);
                    if ($(this).find("img").length > 0) {
                        var func = function ($inBox, $cache) {
                            return function () {
                                if (!$inBox.data("firstImageLoaded")) {
                                    $inBox.data("firstImageLoaded", "true");
                                    $inBox.empty().append($cache.children().clone(true));
                                    $inBox.columnize(options)
                                }
                            }
                        } ($(this), $cache);
                        $(this).find("img").one("load", func);
                        $(this).find("img").one("abort", func);
                        return
                    }
                }
            }
            $inBox.empty();
            columnizeIt();
            if (!options.buildOnce) {
                $(window).resize(function () {
                    if (!options.buildOnce && $.browser.msie) {
                        if ($inBox.data("timeout")) {
                            clearTimeout($inBox.data("timeout"))
                        }
                        $inBox.data("timeout", setTimeout(columnizeIt, 200))
                    } else {
                        if (!options.buildOnce) {
                            columnizeIt()
                        } else { }
                    }
                })
            }
            function columnize($putInHere, $pullOutHere, $parentColumn, height) {
                while ($parentColumn.height() < height && $pullOutHere[0].childNodes.length) {
                    $putInHere.append($pullOutHere[0].childNodes[0])
                }
                if ($putInHere[0].childNodes.length == 0) {
                    return
                }
                var kids = $putInHere[0].childNodes;
                var lastKid = kids[kids.length - 1];
                $putInHere[0].removeChild(lastKid);
                var $item = $(lastKid);
                if ($item[0].nodeType == 3) {
                    var oText = $item[0].nodeValue;
                    var counter2 = options.width / 18;
                    if (options.accuracy) {
                        counter2 = options.accuracy
                    }
                    var columnText;
                    var latestTextNode = null;
                    while ($parentColumn.height() < height && oText.length) {
                        if (oText.indexOf(" ", counter2) != "-1") {
                            columnText = oText.substring(0, oText.indexOf(" ", counter2))
                        } else {
                            columnText = oText
                        }
                        latestTextNode = document.createTextNode(columnText);
                        $putInHere.append(latestTextNode);
                        if (oText.length > counter2) {
                            oText = oText.substring(oText.indexOf(" ", counter2))
                        } else {
                            oText = ""
                        }
                    }
                    if ($parentColumn.height() >= height && latestTextNode != null) {
                        $putInHere[0].removeChild(latestTextNode);
                        oText = latestTextNode.nodeValue + oText
                    }
                    if (oText.length) {
                        $item[0].nodeValue = oText
                    } else {
                        return false
                    }
                }
                if ($pullOutHere.children().length) {
                    $pullOutHere.prepend($item)
                } else {
                    $pullOutHere.append($item)
                }
                return $item[0].nodeType == 3
            }
            function split($putInHere, $pullOutHere, $parentColumn, height) {
                if ($pullOutHere.children().length) {
                    $cloneMe = $pullOutHere.children(":first");
                    $clone = $cloneMe.clone(true);
                    if ($clone.attr("nodeType") == 1 && !$clone.hasClass("dontend")) {
                        $putInHere.append($clone);
                        if ($clone.is("img") && $parentColumn.height() < height + 20) {
                            $cloneMe.remove()
                        } else {
                            if (!$cloneMe.hasClass("dontsplit") && $parentColumn.height() < height + 20) {
                                $cloneMe.remove()
                            } else {
                                if ($clone.is("img") || $cloneMe.hasClass("dontsplit")) {
                                    $clone.remove()
                                } else {
                                    $clone.empty();
                                    if (!columnize($clone, $cloneMe, $parentColumn, height)) {
                                        if ($cloneMe.children().length) {
                                            split($clone, $cloneMe, $parentColumn, height)
                                        }
                                    }
                                    if ($clone.get(0).childNodes.length == 0) {
                                        $clone.remove()
                                    }
                                }
                            }
                        }
                    }
                }
            }
            function singleColumnizeIt() {
                if ($inBox.data("columnized") && $inBox.children().length == 1) {
                    return
                }
                $inBox.data("columnized", true);
                $inBox.data("columnizing", true);
                $inBox.empty();
                $inBox.append($("<div class='first last column' style='width:98%; padding: 3px; float: " + options["float"] + ";'></div>"));
                $col = $inBox.children().eq($inBox.children().length - 1);
                $destroyable = $cache.clone(true);
                if (options.overflow) {
                    targetHeight = options.overflow.height;
                    columnize($col, $destroyable, $col, targetHeight);
                    if (!$destroyable.children().find(":first-child").hasClass("dontend")) {
                        split($col, $destroyable, $col, targetHeight)
                    }
                    while (checkDontEndColumn($col.children(":last").length && $col.children(":last").get(0))) {
                        var $lastKid = $col.children(":last");
                        $lastKid.remove();
                        $destroyable.prepend($lastKid)
                    }
                    var html = "";
                    var div = document.createElement("DIV");
                    while ($destroyable[0].childNodes.length > 0) {
                        var kid = $destroyable[0].childNodes[0];
                        for (var i = 0; i < kid.attributes.length; i++) {
                            if (kid.attributes[i].nodeName.indexOf("jQuery") == 0) {
                                kid.removeAttribute(kid.attributes[i].nodeName)
                            }
                        }
                        div.innerHTML = "";
                        div.appendChild($destroyable[0].childNodes[0]);
                        html += div.innerHTML
                    }
                    var overflow = $(options.overflow.id)[0];
                    overflow.innerHTML = html
                } else {
                    $col.append($destroyable)
                }
                $inBox.data("columnizing", false);
                if (options.overflow) {
                    options.overflow.doneFunc()
                }
            }
            function checkDontEndColumn(dom) {
                if (dom.nodeType != 1) {
                    return false
                }
                if ($(dom).hasClass("dontend")) {
                    return true
                }
                if (dom.childNodes.length == 0) {
                    return false
                }
                return checkDontEndColumn(dom.childNodes[dom.childNodes.length - 1])
            }
            function columnizeIt() {
                if (lastWidth == $inBox.width()) {
                    return
                }
                lastWidth = $inBox.width();
                var numCols = Math.round($inBox.width() / options.width);
                if (options.columns) {
                    numCols = options.columns
                }
                if (numCols <= 1) {
                    return singleColumnizeIt()
                }
                if ($inBox.data("columnizing")) {
                    return
                }
                $inBox.data("columnized", true);
                $inBox.data("columnizing", true);
                $inBox.empty();
                $inBox.append($("<div style='width:" + (Math.round(100 / numCols) - 2) + "%; padding: 3px; float: " + options["float"] + ";'></div>"));
                $col = $inBox.children(":last");
                $col.append($cache.clone());
                maxHeight = $col.height();
                $inBox.empty();
                var targetHeight = maxHeight / numCols;
                var firstTime = true;
                var maxLoops = 3;
                var scrollHorizontally = false;
                if (options.overflow) {
                    maxLoops = 1;
                    targetHeight = options.overflow.height
                } else {
                    if (options.height && options.width) {
                        maxLoops = 1;
                        targetHeight = options.height;
                        scrollHorizontally = true
                    }
                }
                for (var loopCount = 0; loopCount < maxLoops; loopCount++) {
                    $inBox.empty();
                    var $destroyable;
                    try {
                        $destroyable = $cache.clone(true)
                    } catch (e) {
                        $destroyable = $cache.clone()
                    }
                    $destroyable.css("visibility", "hidden");
                    for (var i = 0; i < numCols; i++) {
                        var className = (i == 0) ? "first column" : "column";
                        var className = (i == numCols - 1) ? ("last " + className) : className;
                        $inBox.append($("<div class='" + className + "' style='width:" + (Math.round(100 / numCols) - 2) + "%; float: " + options["float"] + ";'></div>"))
                    }
                    var i = 0;
                    while (i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.children().length) {
                        if ($inBox.children().length <= i) {
                            $inBox.append($("<div class='" + className + "' style='width:" + (Math.round(100 / numCols) - 2) + "%; float: " + options["float"] + ";'></div>"))
                        }
                        var $col = $inBox.children().eq(i);
                        columnize($col, $destroyable, $col, targetHeight);
                        if (!$destroyable.children().find(":first-child").hasClass("dontend")) {
                            split($col, $destroyable, $col, targetHeight)
                        } else { }
                        while (checkDontEndColumn($col.children(":last").length && $col.children(":last").get(0))) {
                            var $lastKid = $col.children(":last");
                            $lastKid.remove();
                            $destroyable.prepend($lastKid)
                        }
                        i++
                    }
                    if (options.overflow && !scrollHorizontally) {
                        var IE6 = false;
                        var IE7 = (document.all) && (navigator.appVersion.indexOf("MSIE 7.") != -1);
                        if (IE6 || IE7) {
                            var html = "";
                            var div = document.createElement("DIV");
                            while ($destroyable[0].childNodes.length > 0) {
                                var kid = $destroyable[0].childNodes[0];
                                for (var i = 0; i < kid.attributes.length; i++) {
                                    if (kid.attributes[i].nodeName.indexOf("jQuery") == 0) {
                                        kid.removeAttribute(kid.attributes[i].nodeName)
                                    }
                                }
                                div.innerHTML = "";
                                div.appendChild($destroyable[0].childNodes[0]);
                                html += div.innerHTML
                            }
                            var overflow = $(options.overflow.id)[0];
                            overflow.innerHTML = html
                        } else {
                            $(options.overflow.id).empty().append($destroyable.children().clone(true))
                        }
                    } else {
                        if (!scrollHorizontally) {
                            $col = $inBox.children().eq($inBox.children().length - 1);
                            while ($destroyable.children().length) {
                                $col.append($destroyable.children(":first"))
                            }
                            var afterH = $col.height();
                            var diff = afterH - targetHeight;
                            var totalH = 0;
                            var min = 10000000;
                            var max = 0;
                            var lastIsMax = false;
                            $inBox.children().each(function ($inBox) {
                                return function ($item) {
                                    var h = $inBox.children().eq($item).height();
                                    lastIsMax = false;
                                    totalH += h;
                                    if (h > max) {
                                        max = h;
                                        lastIsMax = true
                                    }
                                    if (h < min) {
                                        min = h
                                    }
                                }
                            } ($inBox));
                            var avgH = totalH / numCols;
                            if (options.lastNeverTallest && lastIsMax) {
                                targetHeight = targetHeight + 30;
                                if (loopCount == maxLoops - 1) {
                                    maxLoops++
                                }
                            } else {
                                if (max - min > 30) {
                                    targetHeight = avgH + 30
                                } else {
                                    if (Math.abs(avgH - targetHeight) > 20) {
                                        targetHeight = avgH
                                    } else {
                                        loopCount = maxLoops
                                    }
                                }
                            }
                        } else {
                            $inBox.children().each(function (i) {
                                $col = $inBox.children().eq(i);
                                $col.width(options.width + "px");
                                if (i == 0) {
                                    $col.addClass("first")
                                } else {
                                    if (i == $inBox.children().length - 1) {
                                        $col.addClass("last")
                                    } else {
                                        $col.removeClass("first");
                                        $col.removeClass("last")
                                    }
                                }
                            });
                            $inBox.width($inBox.children().length * options.width + "px")
                        }
                    }
                    $inBox.append($("<br style='clear:both;'>"))
                }
                $inBox.find(".column").find(":first.removeiffirst").remove();
                $inBox.find(".column").find(":last.removeiflast").remove();
                $inBox.data("columnizing", false);
                if (options.overflow) {
                    options.overflow.doneFunc()
                }
                options.doneFunc()
            }
        })
    }
})(jQuery); 


jQuery.easing.jswing = jQuery.easing.swing;

UTIL = {
    fire: function (d, a, b) {
        var c = FOO;
        a = (a === undefined) ? "init" : a;
        if (d !== "" && c[d] && typeof c[d][a] == "function") {
            c[d][a](b)
        }
    },
    loadEvents: function () {
        var a = document.body.id;
        UTIL.fire("common");
        UTIL.fire("common", a);
        UTIL.fire("common", "finalize")
    }
};

FOO = {
    common: {
        init: function () {
            $(".no-csscolumns nav#headerColumns").columnize({
                columns: 3,
                doneFunc: function () {
                    $(".no-csscolumns nav#headerColumns").css({
                        width: "490px"
                    })
                }
            });
            $(".no-csscolumns nav#footerColumns").columnize({
                columns: 3,
                doneFunc: function () {
                    $(".no-csscolumns nav#footerColumns").css({
                        width: "500px"
                    })
                }
            });
            $(".no-csscolumns div.columns").columnize({
                width: 300,
                doneFunc: function () {
                    $(".no-csscolumns div.columns .column:not(.first)").css({
                        "margin-left": "20px"
                    })
                }
            });
            var a = $("header").outerHeight() + $("div.subNav").outerHeight();
            $("div.subNav").css({
                position: "fixed",
                top: $("header").outerHeight() + "px",
                left: 0
            });
            $("body").css({
                "padding-top": a
            });
            Modernizr.addTest("ipad",
			function () {
			    return !!navigator.userAgent.match(/iPad/i)
			});
            Modernizr.addTest("iphone",
			function () {
			    return !!navigator.userAgent.match(/iPhone/i)
			});
            Modernizr.addTest("ipod",
			function () {
			    return !!navigator.userAgent.match(/iPod/i)
			});
            Modernizr.addTest("appleios",
			function () {
			    return (Modernizr.ipad || Modernizr.ipod || Modernizr.iphone)
			});
            Modernizr.addTest("positionfixed",
			function () {
			    var g = document.createElement("div"),
				f = g.cloneNode(false),
				c = false,
				b = document.body || (function () {
				    c = true;
				    return document.documentElement.appendChild(document.createElement("body"))
				} ());
			    var e = b.style.cssText;
			    b.style.cssText = "padding:0;margin:0";
			    g.style.cssText = "position:fixed;top:42px";
			    b.appendChild(g);
			    b.appendChild(f);
			    var d = g.offsetTop !== f.offsetTop;
			    b.removeChild(g);
			    b.removeChild(f);
			    b.style.cssText = e;
			    if (c) {
			        document.documentElement.removeChild(b)
			    }
			    return d && !Modernizr.appleios
			})
        },
        error: function () {
            var d = $(window);
            var b = $("header").outerHeight() + $("div.subNav").outerHeight();
            var c = $("footer").outerHeight();
            var e = d.height();
            var a = e - b - c;
            $(".lastPanel").css({
                height: a + "px"
            });
            $(".lastPanel").children(".errorItem").css({
                height: a + "px"
            });
            d.resize(function () {
                var g = d.height();
                var f = g - b - c;
                $(".lastPanel").css({
                    height: f + "px"
                });
                $(".lastPanel").children(".errorItem").css({
                    height: f + "px"
                })
            })
        },
        searchResults: function () {
            $("form#search").form();
            if ($(".sectionOne").length == 0) {
                var e = $(window);
                var b = $("header").outerHeight() + $("div.subNav").outerHeight();
                var c = $("footer").outerHeight();
                var d = $(".form").outerHeight();
                var f = e.height();
                var a = f - b - c - d;
                $(".yellowBar").css({
                    "padding-top": a / (100 / 45) + "px",
                    "padding-bottom": a / (100 / 55) + "px"
                });
                e.resize(function () {
                    var h = e.height();
                    var g = h - b - c - d;
                    $(".yellowBar").css({
                        "padding-top": g / (100 / 45) + "px",
                        "padding-bottom": g / (100 / 55) + "px"
                    })
                })
            }
            $("div.initial, div.resultsCopy").each(function (g, h) {
                $(this).css({
                    cursor: "pointer"
                });
                $(this).mouseup(function () {
                    window.location = jQuery(this).parent().attr("data-url")
                });
                $(this).mouseenter(function () {
                    $(this).parent().find("img.initial").stop(true, false).animate({
                        top: "-8px"
                    },
					150);
                    $(this).parent().find("img.initialShadow").stop(true, false).animate({
                        opacity: 0.5
                    },
					150)
                });
                $(this).mouseleave(function () {
                    $(this).parent().find("img.initial").stop(true, false).animate({
                        top: "0px"
                    },
					300);
                    $(this).parent().find("img.initialShadow").stop(true, false).animate({
                        opacity: 1
                    },
					300)
                })
            })
        },
        newsblog: function () {

            console.log("newsblog");

            $("div.newsItemDate, div.newsItemCopy").each(function (a, b) {
                $(this).css({
                    cursor: "pointer"
                });
                $(this).mouseup(function () {
                    window.location = jQuery(this).parent().attr("data-url")
                })
            })
        },
        home: function () {

            console.log("home 604");
            //$("form#search").form();

            var d = $("header").outerHeight();
            $("#sideNav ul").localScroll({
                offset: {
                    left: 0,
                    top: d * -1
                },
                easing: "easeInOutExpo"
            });
            $(".no-csscolumns div#contactColumns").columnize({
                columns: 2,
                doneFunc: function () {
                    $(".no-csscolumns div#contactColumns").css({
                        width: "650px"
                    })
                }
            });
            var j = $("#contactCopy").offset();
            $("#copy").css({
                left: j.left + "px"
            });
            var b = $(window);
            var h = $("footer").outerHeight();
            var c = $("section#contact").outerHeight();
            var a = b.height();
            var f = a - d - h - c;
            if (f > 0) {
                $("section#contact").css({
                    "padding-bottom": f + "px"
                })
            }
            if (!Modernizr.appleios) {
                var b = $(window);
                var a = b.height();
                var k = 775;
                var i = 775 / a;
                $('section[data-type="background"]').bind("inview",
				function (l, m) {
				    m == true ? $(this).addClass("inview") : $(this).removeClass("inview")
				});
                function g(l, p, o, n, m) {
                    return l + "% " + (-((p + o) - n) * m) + "px"
                }
                function e() {
                    var l = b.scrollTop();
                    $("#sideNav").find("a").removeClass("active");
                    if (l < 550) {
                        $("a#introAnchor").addClass("active")
                    }
                    if (l >= 550 && l < 1250) {
                        $("a#clientsAnchor").addClass("active")
                    }
                    if (l >= 1250 && l < 1950) {
                        $("a#newsAnchor").addClass("active")
                    }
                    if (l >= 1950 && l < 2650) {
                        $("a#citiesAnchor").addClass("active")
                    }
                    if (l >= 2650 && l < 3350) {
                        $("a#testimonialsAnchor").addClass("active")
                    }
                    if (l >= 3350 && l < 4050) {
                        $("a#twitterAnchor").addClass("active")
                    }
                    if (l >= 4050 && l < 4750) {
                        $("a#searchAnchor").addClass("active")
                    }
                    if (l >= 4750) {
                        $("a#contactAnchor").addClass("active")
                    }
                    $('section[data-type="background"]').each(function (m, n) {
                        if (typeof jQuery(this).attr("data-speed") !== "undefined" && jQuery(this).attr("data-speed") !== false) {
                            jQuery(this).css({
                                backgroundPosition: g(50, a * i, l, jQuery(this).attr("data-yoffset"), jQuery(this).attr("data-speed"))
                            })
                        }
                        if ($(n).hasClass("inview")) {
                            jQuery(this).find('div[data-type="sprite"]').each(function (o, p) {
                                $(p).css({
                                    backgroundPosition: g(50, a * i, l, jQuery(this).attr("data-yoffset"), jQuery(this).attr("data-speed"))
                                })
                            })
                        }
                    })
                }
                b.resize(function () {
                    e();
                    var m = $("#contactCopy").offset();
                    $("#copy").css({
                        left: m.left + "px"
                    });
                    var n = b.height();
                    var l = n - d - h - c;
                    if (l > 0) {
                        $("section#contact").css({
                            "padding-bottom": l + "px"
                        })
                    }
                });
                b.bind("scroll",
				function () {
				    e()
				})
            }
        },
        translationservices: function () {
            $("div.serviceBody, div.serviceBottom").each(function (a, b) {
                $(this).css({
                    cursor: "pointer"
                });
                $(this).mouseup(function () {
                    window.location = jQuery(this).parent().attr("data-url")
                });
                $(this).mouseenter(function () {
                    $(this).parent().find("img.initial").stop(true, false).animate({
                        top: "-8px"
                    },
					150);
                    $(this).parent().find("img.initialShadow").stop(true, false).animate({
                        opacity: 0.5
                    },
					150)
                });
                $(this).mouseleave(function () {
                    $(this).parent().find("img.initial").stop(true, false).animate({
                        top: "0px"
                    },
					300);
                    $(this).parent().find("img.initialShadow").stop(true, false).animate({
                        opacity: 1
                    },
					300)
                })
            })
        },
        contactus: function () {
            $("form#contact").form()
        },
        finalize: function () { }
    }
};

$(window).load(UTIL.loadEvents);